SWEP.Author = "Brwarner";
SWEP.Contact = "";
SWEP.Purpose = "Removes blocks that you are allowed to";
SWEP.Instructions = "Left-Click: Remove block";

SWEP.Spawnable = true;
SWEP.AdminSpawnable = true;

SWEP.ViewModel = "models/weapons/v_physcannon.mdl";
SWEP.WorldModel = "models/weapons/w_physics.mdl";

SWEP.Primary.ClipSize = -1;
SWEP.Primary.DefaultClip = -1;
SWEP.Primary.Automatic = false;
SWEP.Primary.Ammo = "none";

SWEP.Secondary.ClipSize = -1;
SWEP.Secondary.DefaultClip = -1;
SWEP.Secondary.Automatic = false;
SWEP.Secondary.Ammo = "none";

//Left-Click action
function SWEP:PrimaryAttack()
	if(!SERVER) then return; end
	
	//Get traceline
	local tr = self.Owner:GetEyeTrace();
	
	//Test for validity
	local ent = tr.Entity;
	if(ent && ent:IsValid() && ent:GetClass() == "bh_block" && ent.block.PlayerSpawn && ent.block.Team == self.Weapon.Owner:Team()) then
		//If so, delete the entity
		ent.block:Removed();
		ent:Remove();
	end
end